<template>
  <div class="page-card">
    <plate-card :icon="TitleIcon" title="农机作业信息">
      <div class="h-[90px] flex items-center justify-between">
        <div v-for="(item, index) in infoData" :key="index" class="info-item">
          <div class="header">{{ item.title }}</div>
          <div class="content">
            <span class="relative z-10">{{ item.value }}<span v-if="index === 2">%</span></span>
            <div v-if="index === 2" :style="{ width: item.value + '%' }" class="progress"></div>
          </div>
        </div>
      </div>
    </plate-card>
  </div>
</template>

<script lang="ts" setup>
  import PlateCard from '@/components/plate-card.vue'
  import TitleIcon from '@/assets/images/card-title/work-info.png'

  import { ref } from 'vue'

  const infoData = ref([
    { title: '作业类型', value: '平整' },
    { title: '作业面积', value: '562 M²' },
    { title: '作业进度', value: 82 }
  ])
</script>

<style lang="scss" scoped>
  .info-item {
    //margin: 0 8px;
    display: flex;
    flex-direction: column;
    width: 32.5%;
    height: 70px;
    border-radius: 4px;
    font-size: 14px;
    border: 1px solid #0075a5;
    overflow: hidden;
    //color: #00d9ff;
    //background: rgba(0, 154, 255, 0.4);
    .header {
      height: 28px;
      line-height: 28px;
      text-align: center;
      color: #00d9ff;
      background: #00598b;
      //border-radius: 4px 4px 0 0;
    }
    .content {
      position: relative;
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
      font-size: 16px;
      z-index: 1;
      .progress {
        position: absolute;
        left: 0;
        height: 100%;
        background: linear-gradient(to right, #000845, #002f6a);
        z-index: 0;
      }
    }
  }
</style>
